<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}

			/* 浮动 */
			.left {
				width: 200px;
				height: 100px;
				background-color: #008000;
				float: left;
			}

			.right {
				width: 100%;
				height: 100px;
				background-color: #FF0000;
				margin-left: 200px;
			}

			/* 表格 */
			.two-box {
				display: table;
				width: 100%;
				margin-top: 20px;
			}

			.box-left {
				width: 200px;
				height: 100px;
				background-color: pink;
				display: table-cell;
			}

			.box-right {
				height: 100px;
				background-color: #008000;
				display: table-cell;
			}
			
			/* overflow:hidden */
			
			.three-box{
				margin-top: 20px;
			}
			.three-left{
				width: 200px;
				height: 100px;
				background-color: red;
				float: left;
			}
			.three-right{
				height: 100px;
				background-color: #008000;
				overflow: hidden;
			}
			
			/* 三行布局 */
			html,body{
				width: 100%;
				height: 100%;
			}
			.main{
				height: 100%;
				display: grid;
				grid-template-rows:100px auto 100px;
			}
			.top{
				background-color: red;
			}
			.middle{
				background-color: green;
			}
			.bottom{
				background-color: yellow;
			}
			
			/* 元素居中 */
			.wrapper{
				width: 600px;
				height: 600px;
				background-color: #008000;
				position: relative;
			}
			.wrapper div{
				position: absolute;
				top: 50%;
				left: 50%;
				width: 200px;
				height: 200px;
				background-color: pink;
				transform: translate(-50%,-50%);
			}
			.center{
				width: 600px;
				height: 600px;
				background-color: pink;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			.center div{
				width: 200px;
				height: 200px;
				background-color: red;
			}
			.box-center{
				position: relative;
				width: 600px;
				height: 600px;
				background-color: red;
			}
			.box-center div{
				position: absolute;
				top: 0px;
				left: 0px;
				right: 0px;
				bottom: 0px;
				margin: auto auto;
				width: 200px;
				height: 200px;
				background-color: green;
			}
		</style>
	</head>
	<body>
		<h3>两栏布局</h3>
		<div id="box">
			<div class="left"></div>
			<div class="right"></div>
		</div>
		<div class="two-box">
			<div class="box-left"></div>
			<div class="box-right"></div>
		</div>
		<div class="three-box">
			<div class="three-left"></div>
			<div class="three-right"></div>
		</div>
		
		<h3>三行布局</h3>
		<div class="main">
			<div class="top"></div>
			<div class="middle"></div>
			<div class="bottom"></div>
		</div>
		
		<h3>元素居中</h3>
		<div class="wrapper">
			<div></div>
		</div>
		<div class="center">
			<div></div>
		</div>
		<div class="box-center">
			<div></div>
		</div>
	</body>
</html>
